package com.larissa.android.quiz;

import android.util.Log;

import androidx.lifecycle.ViewModel;

public class MainViewModel extends ViewModel {
    int currentIdx=0;
    int rightCount=0;

    boolean isEnd=false;
    boolean hasHelped=false;

    private Question[] questions={
            new Question(R.string.test_bj,true),
            new Question(R.string.test_dc,false),
            new Question(R.string.test_london,true),
            new Question(R.string.test_tokyo,true)
    };

    int getText(){
        return questions[currentIdx].getQuestionId();
    }

    boolean getAnswer(){
        return questions[currentIdx].isQuestionAnswer();
    }

    void checkAnswer(boolean chosen){
        if(!hasHelped && chosen==questions[currentIdx].isQuestionAnswer())
            rightCount+=1;
        currentIdx+=1;
        hasHelped=false;
        if(currentIdx==questions.length){
            isEnd=true;
            currentIdx-=1;
        }
    }
}
